package com.sx.wechat.command.api;

import com.sx.core.mybatis.SessionTemplate;
import com.sx.core.vo.JsonReaderResponse;
import com.sx.wechat.command.cmd.AbstractCommand;
import com.sx.wechat.security.AuthenticationHolder;
import com.sx.wechat.security.Principal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 挂失解挂
 * Created by lihao on 2018/3/21.
 */
@Component("get_student_order_score_sort")
public class Get_student_order_score_sort extends AbstractCommand {
    @Autowired
    SessionTemplate sessionTemplate;
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Autowired
    NamedParameterJdbcTemplate namedParameterJdbcTemplate;


    @Override
    public Object executeApi(HttpServletRequest request, HttpServletResponse response) {
        String orderid=obtain(request,"orderid");
        String sql="select s.*,i.name,i.sno from t_all_score s JOIN t_information i on s.stuid=i.id WHERE s.orderid=? ORDER BY s.score DESC ";
        return new JsonReaderResponse(jdbcTemplate.queryForList(sql,orderid));
    }
}
